<template>
  <div class="app-container">
    <el-form ref="queryForm" :model="queryParams" label-width="80px" size="mini">
      <el-row :gutter="20">
        <el-col :span="4">
          <el-form-item label="项目名称" prop="projectName">
            <el-input v-model="queryParams.projectName" clearable placeholder="请输入项目名称"
                      @keyup.enter.native="handleQuery"/>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label="员工名称" prop="staffName">
            <el-input v-model="queryParams.staffName" clearable placeholder="请输入员工名称"
                      @keyup.enter.native="handleQuery"/>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label-width="10px">
            <el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-table v-loading="loading" :data="noticeConfirmList" border>
      <el-table-column label="项目名称" align="center" prop="projectName" />
      <el-table-column label="员工名称" align="center" prop="staffName" />
      <el-table-column label="是否确认" align="center" prop="isConfirm" >
        <template slot-scope="scope">
          <dict-tag :options="confirmStatusOptions" :value="parseInt(scope.row.isConfirm)"/>
        </template>
      </el-table-column>
      <el-table-column label="确认时间" align="center" prop="confirmTime" >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.confirmTime) }}</span>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
                @pagination="getList" />
  </div>
</template>

<script >
import { getNoticeConfirmList } from "@/api/cld/notice";
import { confirmStatusOptions} from '@/assets/staticDict';
export default {
  name: "noticeConfirmList",
  props: {
    form: {
      type: Object
    }
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 确认明细表格数据
      noticeConfirmList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        noticeId: this.form.noticeId,
        staffName: null,
        projectName: null
      },
      // 通知公告确认明细列表确认状态
      confirmStatusOptions:confirmStatusOptions,
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询物资明细 */
    getList() {
      this.loading = true;
      getNoticeConfirmList(this.queryParams).then(response => {
        this.noticeConfirmList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
  }
};
</script>
